
package edu.cmu.cs.webapp.ioms.actions.ingredient;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;

import edu.cmu.cs.webapp.ioms.views.IngredientInfoView;
import edu.cmu.cs.webapp.ioms.views.IngredientListView;
import edu.cmu.cs.webapp.ioms.views.ProductView;

/**
 * @author Christian
 * 
 */
public class RefreshIngredientViewAction implements IViewActionDelegate {
	private IngredientInfoView view;

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
	 */
	@Override
	public void init(IViewPart view) {
		if (view instanceof IngredientInfoView) {
			this.view = (IngredientInfoView) view;
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
	 */
	@Override
	public void run(IAction action) {
		this.view.refreshIngredientsView();

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action
	 * .IAction, org.eclipse.jface.viewers.ISelection)
	 */
	@Override
	public void selectionChanged(IAction action, ISelection selection) {
		// empty change
	}

}
